import { date } from '../../uni_modules/uview-plus/libs/function/test'
import request from '@/utils/request'

// 创建订单
export function createOrder(data) {
  return request({
    url: '/app_api/order/create',
    method: 'post',
    data: data
  })
}
// 价格计算
export function calculatProductList(data, sellChannel) {
  return request({
    url: `/app_api/order/calculat-productList/${sellChannel}`,
    method: 'post',
    data: data
  })
}
// 金额计算
export function orderCalculat(data) {
  return request({
    url: `/app_api/order/calculat`,
    method: 'post',
    data: data
  })
}
// 订单列表
export function orderList(data) {
  return request({
    url: '/app_api/order/list',
    method: 'post',
    data: data
  })
}
// 订单列表(主订单)
export function orderMainList(data) {
  return request({
    url: '/app_api/order/list-main',
    method: 'post',
    data: data
  })
}

// 订单详情
export function orderDetail(query) {
  return request({
    url: query.orderNumber ? `/app_api/order/applet-detail/${query.orderNumber}` : `/app_api/order/detail/${query.id}`,
    method: 'get'
  })
}

// 物流详情
export function orderExpress(query) {
  return request({
    url: `/app_api/order/express-info/${query.id}`,
    method: 'get'
  })
}

// 订单取消
export function orderCancel(query) {
  return request({
    url: `/app_api/order/cancel/${query.id}`,
    method: 'get'
  })
}

// 确认收货
export function orderConfirmReceipt(query) {
  return request({
    url: `/app_api/order/confirm-receipt/${query.id}`,
    method: 'get'
  })
}

// 支付方式
export function appPayConfigList(query) {
  return request({
    url: `/app_api/app-pay-config/list`,
    method: 'get'
  })
}

// 是否支付
export function payQuery(query) {
  return request({
    url: `/app_api/app/allin/pay/query/${query.orderNumber}`,
    method: 'get'
  })
}

// app支付
export function appPay(query) {
  return request({
    url: `/app_api/app/allin/pay/app/${query.paymentId}/${query.orderNumber}`,
    method: 'get'
  })
}
// 是否支付
export function payUnitorder(query) {
  return request({
    url: `/app_api/app/allin/pay/unitorder/${query.orderNumber}`,
    method: 'get'
  })
}
// 微信h5支付
export function h5Pay(query) {
  return request({
    url: `/app_api/app/wechat/pay-h5/${query.orderNumber}`,
    method: 'post'
  })
}
// 微信支付
export function wxPay(query) {
  return request({
    url: `/app_api/app/wechat/pay/${query.orderNumber}`,
    method: 'get'
  })
}
// 微信小程序支付
export function wxAppletPay(data) {
  return request({
    url: `/app_api/app/wechat/pay-applet/${data.orderNumber}`,
    method: 'post'
  })
}
// 余额支付
export function balancePay(query) {
  return request({
    url: `/app_api/order/balance-pay/${query.id}`,
    method: 'get'
  })
}

